# - Try to find boost
# TO MERGE: /usr/share/cmake-3.15/Modules/FindBoost.cmake
#

set(BOOST_VERSION 1.58.0)
set(PREBUILT_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)

# xiaofeng: to remove to settings
set(Protobuf_USE_STATIC_LIBS "ON" )

find_path(Boost_INCLUDE_DIR boost config.hpp
   HINTS ${PREBUILT_LIBRARIES}/boost-${BOOST_VERSION}/include
)

find_library(Boost_LIBRARY NAMES libboost_system.a
   HINTS ${PREBUILT_LIBRARIES}/boost-${BOOST_VERSION}/linux/${CMAKE_SYSTEM_PROCESSOR}/lib
)

# xiaofeng: we only use static-lib
link_directories(${PREBUILT_LIBRARIES}/boost-${BOOST_VERSION}/linux/${CMAKE_SYSTEM_PROCESSOR}/lib)
set(Boost_LIBRARIES libboost_filesystem.a libboost_log.a libboost_serialization.a
                    libboost_system.a libboost_thread.a libboost_program_options.a
                    libboost_test_exec_monitor.a libboost_unit_test_framework.a
                    libboost_log_setup.a libboost_iostreams.a
)
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

# handle the QUIETLY and REQUIRED arguments and set Boost_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Boost DEFAULT_MSG Boost_LIBRARY Boost_INCLUDE_DIR)

mark_as_advanced(Boost_INCLUDE_DIR Boost_LIBRARY)
